Skip to content

feat(wildlife): Cat NPC behavior system - sit/groom/sprint states (#142)#146

Merged
putersdcat merged 7 commits intomainfrom
feature/142-cat-npc-behaviors-and-131-survival-ux
Feb 17, 2026
Merged

feat(wildlife): Cat NPC behavior system - sit/groom/sprint states (#142)#146
putersdcat merged 7 commits intomainfrom
feature/142-cat-npc-behaviors-and-131-survival-ux

Conversation

@putersdcat
Copy link
Owner

Cat NPC Behavior System (#142)

Implements comprehensive behavior system for 3 cat species with unique personalities and interactions.

What Changed

New Behavior States

  • Sit: Cat squishes down (scaleY: 0.85), idles for 120-240 frames
  • Groom: Head-bobbing animation with sparkle particles (✨), 90-180 frames
  • Sprint: Burst of speed (5x wander), bouncing animation, 30-60 frames
  • Wander: Now with isWalkableAt() collision checking

Species Behavior Weights

Species Sit Groom Sprint Personality
Orange Tabby 🐱 0.30 0.20 0.15 Balanced, friendly
Black Cat 🐈‍⬛ 0.25 0.15 0.25 Active, mysterious
Persian 🐾 0.40 0.30 0.05 Lazy, regal

Custom Interaction Lines

Each cat species has 3 unique dialog lines replacing the generic "You spotted a..." text. Lines are randomly selected per interaction.

Rendering Enhancements

  • Grooming sparkle particles above cats
  • Sitting visual squish effect
  • Sprint bounce animation

Testing

  • 7 new Playwright E2E tests (tests/gameplay/cat-behaviors.spec.ts)
  • 6 existing wildlife tests pass (no regression)
  • TypeScript clean compile
  • Verified in-game via Playwright MCP: all behaviors observed, dialog confirmed working

Files Changed

  • src/config/wildlife.config.ts — Extended SpeciesDef, species definitions
  • src/wildlife.ts — Behavior engine, walkability, transitions
  • src/main.ts — Rendering enhancements, dialog integration
  • tests/gameplay/cat-behaviors.spec.ts — E2E tests

Closes #142

- Extended SpeciesDef with behaviorWeights and interactLines fields
- Three cat species (orange, black, persian) with unique behavior profiles
- New behavior states: sit (squished idle), groom (sparkle particles), sprint (burst)
- Weighted behavior transitions from idle via pickIdleBehavior()
- Walkability checking for wildlife movement (isWalkableAt)
- Custom cat interaction dialog lines (not generic 'You spotted a...')
- Grooming sparkle particle rendering on canvas
- Sitting visual squish (scaleY: 0.85)
- Sprint animation bouncing offset
- Playwright E2E tests: 7 tests covering species presence, behavior states,
  interaction lines, dialog rendering, behavior weights, performance

All tests pass: cat-behaviors (7/7), wildlife (6/6), tsc --noEmit clean.
…ters (#138)

- Moved cassette player from sidebar to floating popup (🎵 HUD button toggle)
- Removed LLM config from sidebar, consolidated to Options overlay only
- Added API Key field to Options LLM config section
- Fixed broken LLM settings sync in showOptionsOverlay()
- Added mini status meters (⚡💧🧼) visible when sidebar collapsed
- Updated cassette-ui tests to open popup before checking elements
- Updated music tests to open popup before clicking play button
- New E2E test suite: 12 tests for all #138 changes (all pass)
- Regression: cassette-ui 4/4, alpha-qol 15/15, fog-toggle 7/7
- tsc --noEmit clean
…ed ambience (#108)

- Terrain-aware footsteps: surface detection via MICRO_TILE_DEFS, plays
  footstep_grass/dirt/stone samples with pitch variation and cadence throttle
- Positional audio: PannerNode-based spatial audio for campfire and water
  tiles, distance-based start/stop with chunk scanning every 120 frames
- Enhanced ambience: sampled loops (cricket/wind/rain) layered on top of
  oscillator ambience, auto-switching with weather/time-of-day
- Animal calls: random bird chirps (day), owl hoots + frog croaks (night),
  rooster crow on dawn transition
- 12 new E2E tests (all passing), 0 regressions on existing 18 SFX tests
- 5-stage pipeline: fetch → normalize → dedupe → validate → write
- Adapter pattern: manual (existing curated content), opentdb (API + offline cache)
- SHA-256 content-hash deduplication (removed 39 real duplicates)
- Safety filtering for children's content (unsafe term detection)
- Schema v1 validation with category/difficulty/ageBand checks
- ID preservation for existing content (no breaking ID changes)
- Provenance metadata on all items for audit trail
- CLI: npm run content:pipeline [--adapters=manual,opentdb] [--offline] [--validate-only]
- Output: sharded JSON (100 quizzes/shard, 50 articles/shard) + manifest.json
- Content pack upgraded to v2.0.0 (381 quizzes, 30 articles after dedup)
- 10 new E2E tests, all 87 education tests pass
- Deterministic QA: Flesch-Kincaid readability, safety terms, answer consistency
- Reading level presets: early-reader (5-7), elementary (8-10), pre-teen (11-12+)
- Authoring LLM client (separate from game BitNet, OpenAI-compatible)
- Batch rephraser with dry-run mode (prompt generation without LLM)
- Markdown + JSON QA report generator
- CLI: --qa, --rephrase, --dry-run, --target-age flags
- 11/11 new E2E tests, 98/98 education tests pass
- GitHub Actions workflow: validate, QA, rephrase dry-run, review gate
- Triggers: manual dispatch, push/PR (content paths), weekly schedule
- Fail conditions: schema errors and QA errors block merge
- Artifacts: validation + QA reports uploaded for review
- PR template with human review checklist + recovery docs
- Safety check refinement: context-aware terms (blood OK in anatomy)
- 21/21 new tests, 119/119 education tests pass
- Recursive descent expression parser (browser-compatible, zero deps)
- Basic arithmetic (+, -, *, /, ^) with parentheses
- Input normalization: fractions, percentages, commas, unit stripping
- Deterministic validation with rubric + tolerance
- Feature flag: ?freeresponse=1 URL param or localStorage
- canUseFreeResponse() gate: math category + numeric answer only
- Common-mistake feedback support
- 20/20 new tests, 139/139 education tests pass
@putersdcat putersdcat merged commit 7dc2914 into main Feb 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add Cat NPC Wildlife Variants (Orange, Black, Fluffy Gray Persian) with roaming behaviors

1 participant